/**
* @author Meng Zhang
**/

#include "stdafx.h"
#include "Accelerator.h"

void UpdateStatusBar(Accelerator* accel, CStatusBar* bar) {
	const KeyToCommand &state = accel->State();
	std::wstring tmp;
	for (int i = 0;i<state.step;++i) {
		if (state.modifier[i] & MOD_CONTROL) {
			tmp+=L"C-";
		} else if (state.modifier[i] & MOD_ALT) {
			tmp+=L"M-";
		} else if (state.modifier[i] & MOD_SHIFT) {
			tmp+=L"S-";
		}
		tmp+=tolower((char)LOWORD(MapVirtualKey(state.key[i],MAPVK_VK_TO_CHAR)));
		if (i!=state.step-1)
			tmp+=',';
	}
	bar->SetPaneText(0,tmp.c_str());
}